JBoss Community Archive (Read Only)

ModeShape 3

Compact Node Type (CND) files

This sequencer processes JCR Compact Node Definition (CND) files to extract the node definitions with their property definitions, and inserts these into the repository using aliases of the JCR built-in types. The node structure generated by this sequencer is equivalent to the node structure used in /jcr:system/jcr:nodeTypes.

As an example, the CND file below:

<mode = "http://www.modeshape.org/1.0">

[mode:example] mixin
- mode:name (string) multiple copy
+ mode:child (mode:example) = mode:example version

The resulting graph structure contains the node type information from the CND file above. Note that comments are not sequenced.

<mode:example jcr:primaryType=cnd:nodeType
              cnd:isQueryable=true
              cnd:hasOrderableChildNodes=false
              cnd:nodeTypeName=mode:example
              cnd:supertypes=[]
              cnd:isAbstract=false
              cnd:isMixin=true/>

    <cnd:propertyDefinition cnd:requiredType=STRING
                            jcr:primaryType=cnd:propertyDefinition
                            cnd:multiple=true
                            cnd:autoCreated=false
                            cnd:onParentVersion=COPY
                            cnd:mandatory=false
                            cnd:defaultValues=[]
                            cnd:isFullTextSearchable=true
                            cnd:isQueryOrderable=true
                            cnd:name=mode:name
                            cnd:availableQueryOperators=[]
                            cnd:protected=false
                            cnd:valueConstraints=[] />

    <cnd:childNodeDefinition jcr:primaryType=cnd:childNodeDefinition
                             cnd:sameNameSiblings=false
                             cnd:autoCreated=false
                             cnd:onParentVersion=VERSION
                             cnd:defaultPrimaryType=mode:example
                             cnd:mandatory=false
                             cnd:name=mode:child
                             cnd:protected=false
                             cnd:requiredPrimaryTypes=[mode:example] />

This sequencer can be added to the repository configuration like so:

{
    "name" : "CNDSequencer Test Repository",
    "sequencing" : {
        "removeDerivedContentWithOriginal" : true,
        "sequencers" : {
            "CND Sequencer" : {
                "description" : "CND Sequencer Same Location",
                "classname" : "CNDSequencer",
                "pathExpressions" : [ "default://(*.cnd)/jcr:content[@jcr:data]" ]
            }
        }
    }
}

As with other sequencers, you may want to use a more restrictive input path expression. For example, if you only want to sequence the CND files stored anywhere under the "/global/nodeTypes/cnd" area in the "metadata" workspace, then the path expression might be this:

metadata:/global/nodeTypes/cnd//(*.cnd)/jcr:content[@jcr:data]
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:06:55 UTC, last content change 2013-03-19 12:42:36 UTC.